Windows 7Pro x64 mapping share (DFS) folder with VBS -> WshNetwork.MapNetworkDrive
We are working in a Windows2003/2008 Domain and the User mappes the Shared folder with Logon-script (VBS). Enforced with GPO.
The command for the mapping in the script is: WshNetwork.MapNetworkDrive
The sript start autmaticly with the GPO "Logon" very well.
On the end of the script, the user receive information about the mapped Drives and the mapped Printer.
He can see for exaplme that the drive Y is mapped with
\\....\....
When he open the Windows Explorer, the drive is not existing.
It the user start the VBS manuel twice again, the drive is existing.
The Logon script logs into a file, if errors existis. No error is reported.
I don't understand where the pro
April 13th, 2011 9:43am
Hi,
Thanks for the post!
Since you already automatically start the script in GPO, I recommend you check the script. Refer to here: Example:
VBS Logon Script - MapNetworkDrive.
Here's a similar discussion about the issue:
http://social.technet.microsoft.com/Forums/en/w7itpronetworking/thread/0a7943b4-db41-443b-8ca5-9eea1db6b27a
In addition, I recommend you also ask this questiion in
Script forum.
Regards,
Miya
Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
This posting is provided "AS IS" with no warranties, and confers no rights. | Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial
to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 15th, 2011 2:36am
Hi Miya Yao,
thanks for your answere.
For me is this a part of OS Win7 respectively network, because:
The Script works (I use the debugger VBSEdit on my client). The scipt goes not in the live environent, before the works fine. But in this case, the script works fine
on the workstation, but not in ??? GPO/Network/however ???
Don't forget:
Under user logon, the script ist starting (GPO) and works but the user have no shared drives. The logfile say: the drives are mapped and all is fine.
If you start the script:\\domain\sysvol\...\scripts\logon.vbs again, you have the drive's and all is very well. This is the same VBS-file.
We can say, during the logon procedure, the script don't work fine, but you have no information form the system about errors.
I can't accept that this is a part ob VBS, because the script is OK.
I am new in the forum, so if you say it is better to post this case in the "SCRIPT" Formum, I will do that. Can I change the formum in this case or did I create new thread in the script forum ?
1. I have set the follogwin GPO rouls:
Computer Configuration - Policies - Administrative Templates - System/Logon -> Alwas wait for the network at computer startup and logon = Enable
Computer Configuration - Policies - Administrative Templates - System/Net Logon -> Sysvol share compatiblity = Enable
Computer Configuration - Policies - Administrative Templates - System/Scripts -> Run startup scripts visible = Enable
User Configuration - Policies - Windows Settings - Scripts - Logon - Name ->
\\domain\sysvol\domain\scripts\Logon.vbs
2. VBS:
I use a funktion in the VBS to mapp the share:
NWMapping (zwLW, zwPFAD, zwUSER, zwPW)
If fsystem.DriveExists (zwLW) then
On Error Resume Next
WshNetwork.RemoveNetworkDrive LW, bForce, bUpdateProfile
end if
if zwUser = "" Then
On Error Resume Next
WshNetwork.MapNetworkDrive zwLW, zwPFAD
else
On Error Resume Next
WshNetwork.MapNetworkDrive zwLW, zwPFAD, false, zwUser, zwPW
end if
if Err.Number > 0 then
strMSG = "Error: " & Err.Number & " " & Err.Description & " Netzwerkpfad: " & zwPFAD & " nicht gefunden !"
strMSG = strMSG & CRLF
objLog.Write strMSG
Err.Clear
else
strMSG = "Netzwerkpfad: " & zwPFAD & " wurde mit " & zwLW & " verbunden."
strMSG = strMSG & CRLF
objLog.Write strMSG
end if
Laufwerke=Laufwerke + LW
End function
You can see, I work with "err.number". Is there an error, it will be reportet in the following file (on the user workstation):
strLOG = sMyDocs & "\Logon_" & Jahr & Monat & Tag & "_" & Stunde & Minuten & ".log"
The repoting in the Logfile works very well.
If the user don't have the share in the windows explorer, I have no error message in the logfile. If you look in the logfile, it seems all is very well, but it is not true.
I told, that the user receive on the end of the VBS a windows with information about the share drives and the share printer (this will be close after 10 secounds automaticly).
This information is not a part of "self programing" in VBS.
It is related to the system:
Set colDrives = wshNetwork.EnumNetworkDrives
If colDrives.Count = 0 Then
strMsg = strMsg & CRLF & "No Drive is connected." & CRLF
Else
strMsg = strMsg & CRLF & "Connected Drive's:" & CRLF
For i = 0 To colDrives.Count - 1 Step 2
strMsg = strMsg & CRLF & colDrives(i) & Chr(9) & colDrives(i + 1)
zw_LW=zw_LW+left(colDrives(i),1)+":"
Next
End If
I hope everybody can better understand the problem now.
April 15th, 2011 3:55am
Hi,
Thanks for the quick update.
Do you turn on the UAC on your clients?
Becasue the group policy scripts can fail due to User Account Control. Please refer to here:http://technet.microsoft.com/en-us/library/cc766208(WS.10).aspx
For the workaround, check it here:
After you turn on User Account Control in Windows Vista, program may be unable to access some network locations. (It's also applied for Windows 7.)
Regards,
Miya
TechNet Subscriber Support in forum. If you have any feedback on our support, please contact
tngfb@microsoft.comThis posting is provided "AS IS" with no warranties, and confers no rights. | Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer
your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
April 15th, 2011 6:31am
Hi Miya,
thanks for your proposal. The problems are related to the UAC.
I have set the following roules in the GPO:
Computer - Policies - Windows Settings - Local Policies/Securety Options - User Account Control
1. User Account Control. Behavior of the elevation prompt for administration in Admin Approvel Mode = Elevate without prompting
2. User Account Control. Detec application installations and prompt for elevation = Disabled
3. Run all administration in Admin Approval Mode = Disable
However, now it works.
I don't understand what Microsoft with UAC is doing in a company. We admins can't need the UAC in the daily work.
In my case, I have disabled the UAC for all User in the company. I know that is not good in case of security, but it is the only way that the user can work without problems.
Thanks Miya
April 19th, 2011 10:02am